﻿using NDF.Framework;
using NDF.Framework.Models.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace NDF.WebClient.Controllers
{
    public class LoginController : Controller
    {
        // GET: Login
        [HttpGet]
        [AllowAnonymous]
        public ActionResult Index()
        {
            this.ViewBag.SystemTitle = SystemEnvironment.SystemTitleAbbreviation;
            var model = new LoginView { LoginCode = "000", Password = "123", Captcha = "abc" };
            return View(model);
        }


        [HttpPost]
        [AllowAnonymous]
        public ActionResult Index(LoginView model)
        {
            if (model.LoginCode == "000" && model.Password == "123")
            {
                return this.JsonStatus(true, "登录成功!", this.Url.Action("Index", "Home"));
            }
            else
            {
                return this.JsonStatus(false, "登录失败，用户名或密码错误!");
            }
        }
    }
}
